function TITTSocket() {

	var xhr = new XMLHttpRequest();
	
	var output = new TITTOutputStream(xhr);
	var input = new TITTInputStream(xhr);
	
	var hw = new HeadWriter(xhr, output);
	var hr = new HeadReader(input);

	this.isClosed = false;
	
	this.getHeadWriter = function() {
		return hw;
	}
	
	this.getHeadReader = function() {
		return hr;
	}
	
	this.getOutputStream = function() {
		return output;
	}
	
	this.getInputStream = function() {
		return input;
	}
	
	
	this.close = function() {
		input.close();
		output.close();
		hw.close();
		hr.close();

//this results in ugly red console output :(	
//		xhr.abort();
		this.isClosed = true;
	}
}
